import request from '@/utils/request'

export function getCates(params) {
  return request({
    url: 'api/queryCategory',
    method: 'get',
    params
  })
}

export function getCatesLevel2() {
  return request({
    url: 'api/queryCategoryLevel2',
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: 'api/addCategory',
    method: 'post',
    data
  })
}

export function del(id) {
  return request({
    url: 'api/deleteCategory/' + id,
    method: 'delete'
  })
}

export function edit(data) {
  return request({
    url: 'api/updateCategory',
    method: 'put',
    data
  })
}

export default { add, edit, del, getCates, getCatesLevel2 }
